# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name：     day122_pyqt5_combin
   Description :
   Author :       fuml
   date：          2019/9/21
-------------------------------------------------
   Change Activity:
                   2019/9/21:
                   This program creates a skeleton of
a classic GUI application with a menubar,
toolbar, statusbar, and a central widget.
-------------------------------------------------
"""
import sys

from PyQt5.QtWidgets import (QMainWindow,QTextEdit,QAction,\
                QApplication,QStatusBar,QMenu,QMenuBar,QToolBar)
from PyQt5.QtGui import QIcon

class Example(QMainWindow):
    def __init__(self):
        super().__init__()

        self.initUI()

    def initUI(self):
        textEdit = QTextEdit()
        self.setCentralWidget(textEdit)

        exitAction = QAction(QIcon('exit.png'),'&Exit',self)
        exitAction.setShortcut('Ctrl+Q')
        exitAction.setStatusTip('Exit Application')
        exitAction.triggered.connect(self.close)

        statusbar = self.statusBar()

        menubar:QMenuBar = self.menuBar()
        filemenu:QMenu= menubar.addMenu('&File')
        filemenu.addAction(exitAction)

        toolbar:QToolBar=self.addToolBar('Exit')
        toolbar.addAction(exitAction)

        self.setGeometry(300,300,350,250)
        self.setWindowTitle('Main window')
        self.show()

if __name__ == '__main__':
    app =QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())